package com.lmk.t01;

import java.io.*;

public class CopyTest {
    public static void main(String[] args) {
        String oldPath="d:/11/02.mp4";
        String newPath="d:/11/03.mp4";
        File sourceFile=new File(oldPath);
        File targetFile=new File(newPath);
        try(
                InputStream is=new FileInputStream(sourceFile);
                OutputStream os=new FileOutputStream(targetFile);

        ) {
            //缓冲数组
            byte[]  butter=new byte[500];

           int len=-1;
           while ((len=is.read(butter))!=-1){
               os.write(butter,0,len);
           }
           os.flush();//清空缓存

        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
